listbox: Move the priv->gadget allocation
authorBenjamin Otte <otte@redhat.com>
Tue, 29 Nov 2016 10:46:32 +0000 (11:46 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 30 Nov 2016 14:15:08 +0000 (15:15 +0100)
It used to be relative to the window, now it is relative to the widget.

That is necessary so the snapshot fuction doesn't confuse coordinate
systems.

gtk/gtklistbox.c

index db3a9a5b392686bfc324f332e60123192062e058..db6e9f00e1f4212a1c2698788f0c69f3737e0880 100644 (file)
@@ -2735,7 +2735,6 @@ gtk_list_box_size_allocate (GtkWidget     *widget,
                             GtkAllocation *allocation)
 {
   GtkListBoxPrivate *priv = BOX_PRIV (widget);
-  GtkAllocation child_allocation;
   GtkAllocation clip;
 
   gtk_widget_set_allocation (widget, allocation);
@@ -2745,18 +2744,11 @@ gtk_list_box_size_allocate (GtkWidget     *widget,
                             allocation->x, allocation->y,
                             allocation->width, allocation->height);
 
-  child_allocation.x = 0;
-  child_allocation.y = 0;
-  child_allocation.width = allocation->width;
-  child_allocation.height = allocation->height;
-
   gtk_css_gadget_allocate (BOX_PRIV (widget)->gadget,
-                           &child_allocation,
+                           allocation,
                            gtk_widget_get_allocated_baseline (widget),
                            &clip);
 
-  clip.x += allocation->x;
-  clip.y += allocation->y;
   gtk_widget_set_clip (widget, &clip);
 }
 
@@ -2772,17 +2764,20 @@ gtk_list_box_allocate (GtkCssGadget        *gadget,
   GtkListBoxPrivate *priv = BOX_PRIV (widget);
   GtkAllocation child_allocation;
   GtkAllocation header_allocation;
+  GtkAllocation widget_allocation;
   GtkListBoxRow *row;
   GSequenceIter *iter;
   int child_min;
 
-  child_allocation.x = allocation->x;
-  child_allocation.y = allocation->y;
+  gtk_widget_get_allocation (widget, &widget_allocation);
+
+  child_allocation.x = allocation->x - widget_allocation.x;
+  child_allocation.y = allocation->y - widget_allocation.y;
   child_allocation.width = allocation->width;
   child_allocation.height = 0;
 
-  header_allocation.x = allocation->x;
-  header_allocation.y = allocation->y;
+  header_allocation.x = allocation->x - widget_allocation.x;
+  header_allocation.y = allocation->y - widget_allocation.y;
   header_allocation.width = allocation->width;
   header_allocation.height = 0;